//
//  ViewController.m
//  IOS-tranfroms
//
//  Created by RIOS on 2018/3/29.
//  Copyright © 2018年 RIOS. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIButton *image;
- (IBAction)btnLeft:(id)sender;
- (IBAction)btnRight:(id)sender;
- (IBAction)btnClean:(id)sender;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (IBAction)btnLeft:(id)sender {
    [UIView animateWithDuration:0.5 animations:^{
//        self.image.transform = CGAffineTransformMakeTranslation(-50, 0);
//        self.image.transform = CGAffineTransformMakeScale(-0.8, 0.8);
//        self.image.transform = CGAffineTransformMakeRotation(-M_PI/360 * 90);
//        self.image.transform = CGAffineTransformTranslate(self.image.transform, -50, 0);
//        self.image.transform = CGAffineTransformScale(self.image.transform, -0.8, -0.8);
        self.image.transform = CGAffineTransformRotate(self.image.transform, M_PI_4);
        
    }];
    }

- (IBAction)btnRight:(id)sender {
    [UIView animateWithDuration:0.5 animations:^{
//        self.image.transform = CGAffineTransformMakeTranslation(50, 0);
//        self.image.transform = CGAffineTransformMakeScale(-1.5, 1.5);
//          self.image.transform = CGAffineTransformMakeRotation(M_PI/360 * 90);
//        self.image.transform = CGAffineTransformTranslate(self.image.transform, 50, 0);
//        self.image.transform = CGAffineTransformScale(self.image.transform, -1.2, -1.2);
       self.image.transform = CGAffineTransformRotate(self.image.transform, -M_PI_4);
    }];
}

- (IBAction)btnClean:(id)sender {
    self.image.transform = CGAffineTransformIdentity;
}
@end
